﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace DefiningClasses
{
    enum BatteryType
    {
        LiIon,
        NiMH,
        NiCD,
        Unknown
    }
    class Phone
    {
        string Model = "";
        string Manufacturer = "";
        Decimal Price = 0;
        string Owner = "";
        Battery batery;
        Display display;
        static void Main(string[] args)
        {
        }
        public Phone(string Model, string Manufacturer)
            : this(Model, Manufacturer, 0, null, null, null)
        {

        }
        public Phone(string Model, string Manufacturer, decimal Price = 0, string Owner = "", Battery batery = null, Display display = null)
        {
            this.Model = Model;
            this.Manufacturer = Manufacturer;
            this.Price = Price;
            this.Owner = Owner;
            this.batery = batery;
            this.display = display;
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Model".PadRight(14)+"-"+this.Model);
            sb.AppendLine("Manufacturer".PadRight(14)+"-"+this.Manufacturer);
            sb.AppendLine("Price".PadRight(14) + "-" + this.Price);
            sb.AppendLine("Ownder".PadRight(14) + "-" + this.Owner);
            sb.AppendLine(this.batery.ToString());
            sb.AppendLine(this.display.ToString());
            return sb.ToString();
        }
    }
    class Battery
    {
        string Manufacturer = "";
        TimeSpan hoursIdle;
        TimeSpan hoursTalk;
        BatteryType batteryType;
        public Battery(string Manufacturer)
            : this(Manufacturer, new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0), BatteryType.Unknown)
        {

        }
        public Battery(string Manufacturer, TimeSpan hoursIdle, TimeSpan hoursTalk, BatteryType batteryType)
        {
            this.Manufacturer = Manufacturer;
            this.hoursIdle = hoursIdle;
            this.hoursTalk = hoursTalk;
            this.batteryType = batteryType;
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Battery");
            sb.AppendLine("Battery manufacturer".PadRight(20) + "-" + this.Manufacturer);
            sb.AppendLine("Hours idle".PadRight(20) + "-" + this.hoursIdle.TotalHours);
            sb.AppendLine("Hours talk".PadRight(20) + "-" + this.hoursTalk.TotalHours);
            return sb.ToString();
        }
    }
    class Display
    {
        float? size = 0.0F;
        int? coloursCount = 0;
        public Display()
            : this(0.0F, 0)
        {

        }
        public Display(float size, int coloursCount)
        {
            this.size = size;
            this.coloursCount = coloursCount;
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Display:");
            sb.AppendLine("Size".PadRight(10) + "-" + this.size);
            sb.AppendLine("Colours".PadRight(10) + "-" + this.coloursCount);
            return sb.ToString();
        }
    }
}
